package com.geovis.emergency.spd.biz.custom.service.impl;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.geovis.emergency.spd.biz.command.service.TfService;
import com.geovis.emergency.spd.biz.custom.service.ITyphoonService;
import com.geovis.emergency.spd.entity.command.entity.Tf;
import com.geovis.emergency.spd.entity.pc.pojo.vo.TyphoonVO;
import com.google.common.collect.Lists;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;

import java.io.File;
import java.io.FileNotFoundException;
import java.nio.charset.StandardCharsets;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 台风服务 实现类
 * </p>
 *
 * @author Lonsho
 * @version 1.0
 * @date 2022/7/6
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class TyphoonServiceImpl implements ITyphoonService {
    @Value("${typhoon.path}")
    private String typhoonPath;

    private final TfService tfService;

    @Override
    public List<TyphoonVO> getTyphoonList(){
        List<Tf> tfs=tfService.getList();
        List<TyphoonVO> typhoonList=tfs.stream().map(tf->{
            TyphoonVO vo=new TyphoonVO();
            vo.setId(tf.getTyphoonId())
                    .setName(tf.getCnName());
            return vo;
        }).collect(Collectors.toList());
        return typhoonList;
    }
}
